﻿@page "/diagram/serialization"

@using Syncfusion.Blazor.Diagrams
@using Syncfusion.Blazor.Navigations
@using System.Collections.ObjectModel
@using Syncfusion.Blazor.Inputs
@using DiagramShapes = Syncfusion.Blazor.Diagrams.Shapes
@using DiagramSegments = Syncfusion.Blazor.Diagrams.Segments
@inherits SampleBaseComponent;

@inject IJSRuntime js

<SampleDescription>
  <p>This sample demonstrates building diagrams interactively and editing the saved diagrams. The symbol palette is used to build diagrams easily.</p> 
  <p style="font-weight: bold;">A new blazor diagram component which provides better performance than the existing diagram control in Blazor WebAssembly App. It is available in preview mode. Check the samples <a target='_blank' href='diagramcomponent/flowchart'>here</a>.</p>
</SampleDescription>
<ActionDescription>
   <p>  This example shows how to drag and drop shapes and connectors from the symbol palette to build diagrams. You can save the diagram as a JSON file and edit the pre-saved diagrams. The <a target='_blank' href='https://blazor.syncfusion.com/documentation/diagram/serialization/#save'>SaveDiagram</a> method can be used to save the diagram as string. The <a target='_blank' href='https://blazor.syncfusion.com/documentation/diagram/serialization/#load'>LoadDiagram</a> method can be used to load the diagram from a string. In this example, the context menu and undo and redo features are enabled.</p>
</ActionDescription>

<div class="control-section">
    <link href="https://ej2.syncfusion.com/javascript/demos/src/diagram/styles/diagram-common.css" rel="stylesheet">
    <div class="sb-mobile-palette-bar">
        <div id="palette-icon" style="float: right;" role="button" class="e-ddb-icons1 e-toggle-palette"></div>
    </div>
    @*Hidden:Lines*@
    <div style="width: 100%;height: 10%">
        <SfToolbar Width="100%">
            <ToolbarItems>
                <ToolbarItem Id="palette-icon" PrefixIcon="e-ddb-icons2 e-toggle-palette .e-tbar-btn .tb-icons" Align="@ItemAlign.Right"></ToolbarItem>
                <ToolbarItem Text="New" ToolTipText="New" PrefixIcon="e-ddb-icons e-new .e-tbar-btn .tb-icons" OnClick="ClearDiagram"></ToolbarItem>
                <ToolbarItem Type="@ItemType.Separator" />
                <ToolbarItem Text="Save" ToolTipText="Save" PrefixIcon="e-ddb-icons e-save .e-tbar-btn .tb-icons" OnClick="DownloadDiagram"></ToolbarItem>
                <ToolbarItem Type="@ItemType.Separator" />
                <ToolbarItem Text="Load" ToolTipText="Load" PrefixIcon="e-ddb-icons e-open .e-tbar-btn .tb-icons" OnClick="LoadDiagram"></ToolbarItem>
                <ToolbarItem Type="@ItemType.Separator" />
            </ToolbarItems>
        </SfToolbar>
    </div>

    @*End:Hidden*@
    <div style="width: 100%;height: 80%">
        <div id="palette-space" class="sb-mobile-palette">
            <SfSymbolPalette ID="palettes" Height="700px"
                                SymbolHeight="60"
                                SymbolWidth="60"
                                EnableAnimation="true"
                                ExpandMode="@ExpandMode.Multiple"
                                SymbolInfo="@SymbolInfo"
                                @ref="@SymbolPalette"
                                Palettes="@Palettes">
                <SymbolMargin Left="15" Right="15" Bottom="15" Top="15"></SymbolMargin>
            </SfSymbolPalette>
        </div>
        <div id="diagram-space" class="sb-mobile-diagram">
            <div class="content-wrapper">
                <SfDiagram @ref="@Diagram" Height="700px"
                            Nodes="@NodeCollection"
                            Connectors="@ConnectorCollection"
                            ConnectorDefaults="@ConnectorDefaults">
                    <DiagramSnapSettings>
                        <HorizontalGridlines LineColor="#e0e0e0 " LineIntervals="@GridLineIntervals">
                        </HorizontalGridlines>
                        <VerticalGridlines LineColor="#e0e0e0" LineIntervals="@GridLineIntervals">
                        </VerticalGridlines>
                    </DiagramSnapSettings>
                </SfDiagram>
            </div>
            <SfUploader @ref="@UploadFiles" Id="UploadFiles" ShowFileList="false">
                <UploaderEvents OnUploadStart="OnUploadSuccess"></UploaderEvents>
                <UploaderAsyncSettings SaveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save" RemoveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove"></UploaderAsyncSettings>
            </SfUploader>
        </div>
    </div>
</div>
@*Hidden:Lines*@
<style>
    .e-file-select-wrap {
        display: none;
    }

    .control-section {
        padding-top: 0px;
        padding-right: 0px;
    }
    .e-bigger .e-tbar-btn .tb-icons {
        font-size: 18px;
    }

    .e-tbar-btn .tb-icons {
        font-family: 'Material_toolbar';
        speak: none;
        font-size: 16px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
    }

    .e-tbar-btn .tb-icons.e-numbering-icon {
        font-size: 17px;
    }


    @@font-face {
        font-family: 'e-ddb-icons';
        src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1tShgAAAEoAAAAVmNtYXDon+lDAAACIAAAAIJnbHlmw/gRIAAAAvgAACw0aGVhZBGJTLcAAADQAAAANmhoZWEIXQQpAAAArAAAACRobXR4oAAAAAAAAYAAAACgbG9jYdYyye4AAAKkAAAAUm1heHABOAD4AAABCAAAACBuYW1ldAwInAAALywAAAMVcG9zdNAiwIsAADJEAAABuQABAAAEAAAAAFwEAAAAAAAEAAABAAAAAAAAAAAAAAAAAAAAKAABAAAAAQAAJo24vV8PPPUACwQAAAAAANc1g90AAAAA1zWD3QAAAAAEAAQAAAAACAACAAAAAAAAAAEAAAAoAOwABgAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wDnJgQAAAAAXAQAAAAAAAABAAAAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAbgAAAAQABAABAADnJv//AADnAP//AAAAAQAEAAAAAQACAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAAAAAAAABBAICAn4C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BhAHQAZQByAGkAYQBsAF8ARABpAGEAZwByAGEAbQBCAHUAaQBsAGQAZQByAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAHUAcwBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAQ0BDgEPARABEQESARMBFAEVARYBFwEYARkBGgEbARwBHQEeAR8BIAEhASIBIwEkASUBJgEnASgBKQAHWm9vbUluTQhab29tT3V0TQpVbmRlcmxpbmVNBlByaW50TQROZXdNBVNhdmVNB0V4cG9ydE0FQm9sZE0LT3BlbkZvbGRlck0HRGVsZXRlTQhSZWZyZXNoTQdJdGFsaWNNB1pvb21JbkYIWm9vbU91dEYGUHJpbnRGBE5ld0YFU2F2ZUYHRXhwb3J0RgVCb2xkRgtPcGVuRm9sZGVyRgdEZWxldGVGCFJlZnJlc2hGClVuZGVybGluZUYHSXRhbGljRgdab29tSW5CCFpvb21PdXRCClVuZGVybGluZUIGUHJpbnRCBE5ld0IFU2F2ZUIHRXhwb3J0QgVCb2xkQgtPcGVuRm9sZGVyQgdEZWxldGVCCFJlZnJlc2hCB0l0YWxpY0IKRmxvd1NoYXBlcwlDb25uZWN0b3ILQmFzaWNTaGFwZXMAAAAAAA==) format('truetype');
        font-weight: normal;
        font-style: normal;
    }

    @@font-face {
        font-family: 'e-ddb-icons2';
        src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1tSfIAAAEoAAAAVmNtYXDnEOdVAAABiAAAADZnbHlmdC1P4gAAAcgAAAAwaGVhZBJhohMAAADQAAAANmhoZWEIVQQDAAAArAAAACRobXR4CAAAAAAAAYAAAAAIbG9jYQAYAAAAAAHAAAAABm1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lAGcAdQBsAGEAcgBEAGkAYQBnAHIAYQBtAF8AUwBoAGEAcABlAHMAXwBGAE8ATgBUAEQAaQBhAGcAcgBhAG0AXwBTAGgAYQBwAGUAcwBfAEYATwBOAFQAVgBlAHIAcwBpAG8AbgAgADEALgAwAEQAaQBhAGcAcgBhAG0AXwBTAGgAYQBwAGUAcwBfAEYATwBOAFQARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAdQBzAGkAbgBnACAAUwB5AG4AYwBmAHUAcwBpAG8AbgAgAE0AZQB0AHIAbwAgAFMAdAB1AGQAaQBvAHcAdwB3AC4AcwB5AG4AYwBmAHUAcwBpAG8AbgAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgECAQMABlNoYXBlcwAA) format('truetype');
        font-weight: normal;
        font-style: normal;
    }

    .e-ddb-icons1 {
        font-family: 'e-ddb-icons';
        speak: none;
        font-size: 16px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .e-basic::before {
        content: "\e726";
    }

    .e-flow::before {
        content: "\e724";
    }

    .e-connector::before {
        content: "\e725";
    }

    .e-ddb-icons {
        font-family: 'e-ddb-icons';
        speak: none;
        font-size: 55px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .e-new::before {
        content: "\e70f";
    }

    .e-save::before {
        content: "\e710";
    }

    .e-open::before {
        content: "\e713";
    }

    .material .e-new::before {
        content: "\e704";
    }

    .material .e-save::before {
        content: "\e705";
    }

    .material .e-open::before {
        content: "\e708";
    }

    .bootstrap .e-new::before {
        content: "\e71c";
    }

    .bootstrap .e-save::before {
        content: "\e71d";
    }

    .bootstrap .e-open::before {
        content: "\e720";
    }

    .sb-mobile-palette {
        width: 240px;
        height: 100%;
        float: left;
    }

    .sb-mobile-palette-bar {
        display: none;
    }

    .sb-mobile-diagram {
        width: calc(100% - 242px);
        height: 100%;
        float: left;
    }

    @@media (max-width: 550px) {

        .sb-mobile-palette {
            z-index: 19;
            position: absolute;
            display: none;
            transition: transform 300ms linear, visibility 0s linear 300ms;
            width: 39%;
            height: 100%;
        }

        .sb-mobile-palette-bar {
            display: block;
            width: 100%;
            background: #fafafa;
            padding: 10px 10px;
            border: 0.5px solid #e0e0e0;
            min-height: 40px;
        }

        .sb-mobile-diagram {
            width: 100%;
            height: 100%;
            float: left;
            left: 0px;
        }

        #palette-icon {
            font-size: 20px;
        }
    }

    .sb-mobile-palette-open {
        position: absolute;
        display: block;
        right: 15px;
    }

    .e-ddb-icons2 {
        font-family: 'e-ddb-icons2';
        speak: none;
        font-size: 16px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .e-toggle-palette::before {
        content: "\e700"
    }

    #palette-icon {
        display: none;
    }

    @@media (max-width: 550px) {
        #palette-icon {
            display: inline-flex;
        }
    }
</style>
@*End:Hidden*@

@code
    {
    SfSymbolPalette SymbolPalette;
    int connectorCount;
    public ObservableCollection<SymbolPalettePalette> Palettes;

    SfUploader UploadFiles;

    // Reference to diagram
    SfDiagram Diagram;

    // Defines diagram's nodes collection
    public ObservableCollection<DiagramNode> NodeCollection { get; set; }

    // Defines diagram's connector collection
    public ObservableCollection<DiagramConnector> ConnectorCollection { get; set; }

    // Defines default values for DiagramConnector object
    public DiagramConnector ConnectorDefaults { get; set; }

    // Defines interval values for GridLines
    public double[] GridLineIntervals { get; set; }

    // Defines palette's flow-shape collection
    public ObservableCollection<object> FlowShapeList { get; set; }

    // Defines palette's connector collection
    public ObservableCollection<object> ConnectorList { get; set; }

    // Defines Symbol info
    public SymbolInfo SymbolInfo { get; set; }

    protected override void OnInitialized()
    {
        InitDiagramModel();
        InitPaletteModel();
    }

    public async Task OnUploadSuccess(UploadingEventArgs success)
    {
        string json = await FileUtil.LoadFile(js, success.FileData);
        json = json.Replace(System.Environment.NewLine, string.Empty);
        Diagram.LoadDiagram(json.ToString());
        await UploadFiles.ClearAll();
    }

    public async Task ClearDiagram(ClickEventArgs args)
    {
        await Diagram.Clear();
        StateHasChanged();
    }

    public async Task DownloadDiagram()
    {
        string data = await Diagram.SaveDiagram();
        await FileUtil.SaveAs(js, data);
    }

    public async Task LoadDiagram()
    {
        await FileUtil.Click(js);
    }

    private void InitDiagramModel()
    {
        GridLineIntervals = new double[] {
            1, 9, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75, 0.25, 9.75
        };

        ConnectorDefaults = new DiagramConnector()
        {
            TargetDecorator = new ConnectorTargetDecorator()
            {
                Height = 5,
                Width = 5,
                Style = new DecoratorShapeStyle() { Fill = "#797979", StrokeColor = "#797979" },
            },
            Style = new ConnectorShapeStyle() { StrokeColor = "#797979" }
        };

        NodeCollection = new ObservableCollection<DiagramNode>();
        ConnectorCollection = new ObservableCollection<DiagramConnector>();

        CreateNode("Start", 450, 80, FlowShapes.Terminator, "Start", "#C2601D");
        CreateNode("Alarm", 450, 195, FlowShapes.Process, "Alarm rings", "#305791");
        CreateNode("Ready", 450, 315, FlowShapes.Decision, "Ready to get Up?", "#C2601D");
        CreateNode("Climb", 450, 435, FlowShapes.Process, "Climb out of bed", "#305791");
        CreateNode("End", 450, 560, FlowShapes.Terminator, "End", "#C2601D");
        CreateNode("Relay", 650, 195, FlowShapes.Delay, "Relay", "#305791");
        CreateNode("Hit", 650, 315, FlowShapes.Process, "Hit snooze button", "#305791");

        CreateConnector("Start", "Alarm");
        CreateConnector("Alarm", "Ready");
        CreateConnector("Ready", "Climb", "Yes");
        CreateConnector("Climb", "End");
        CreateConnector("Ready", "Hit", "No");
        CreateConnector("Hit", "Relay");
        CreateConnector("Relay", "Alarm");
    }

    private void CreateNode(string id, double x, double y, FlowShapes shape, string label, string fillColor)
    {
        DiagramNodeAnnotation annotation = new DiagramNodeAnnotation() { Content = label };

        annotation.Style = new AnnotationStyle()
        {
            Color = "white",
            Fill = "transparent"
        };

        DiagramNode diagramNode = new DiagramNode()
        {
            Id = id,
            OffsetX = x,
            OffsetY = y,
            Width = 120,
            Height = 70,
            Shape = new DiagramShape() { Type = DiagramShapes.Flow, FlowShape = shape },
            Style = new NodeShapeStyle() { Fill = fillColor, StrokeColor = "#797878" },
            Annotations = new ObservableCollection<DiagramNodeAnnotation>() { annotation },
        };
        if (diagramNode.Id.ToString() == "Ready")
        {
            diagramNode.Height = 100;
            diagramNode.Width = 140;
        }
        NodeCollection.Add(diagramNode);
    }

    private void CreateConnector(string sourceId, string targetId, string label = default(string))
    {
        DiagramConnector diagramConnector = new DiagramConnector()
        {
            Id = string.Format("connector{0}", ++connectorCount),
            SourceID = sourceId,
            TargetID = targetId,
        };

        if (label != default(string))
        {
            DiagramConnectorAnnotation annotation = new DiagramConnectorAnnotation()
            {
                Content = label,
                Style = new AnnotationStyle() { Fill = "white" }
            };
            diagramConnector.Annotations = new ObservableCollection<DiagramConnectorAnnotation>() { annotation };
        }

        ConnectorCollection.Add(diagramConnector);
    }

    private void InitPaletteModel()
    {
        Palettes = new ObservableCollection<SymbolPalettePalette>();
        SymbolInfo = new SymbolInfo() { Fit = true };

        FlowShapeList = new ObservableCollection<object>();
        CreatePaletteNode(FlowShapes.Terminator,"Terminator");
        CreatePaletteNode(FlowShapes.Process,"Process");
        CreatePaletteNode(FlowShapes.Decision,"Decision");
        CreatePaletteNode(FlowShapes.Document,"Document");
        CreatePaletteNode(FlowShapes.PreDefinedProcess,"Predefined Process");
        CreatePaletteNode(FlowShapes.PaperTap,"Punched Tape");
        CreatePaletteNode(FlowShapes.DirectData,"Direct Data");
        CreatePaletteNode(FlowShapes.SequentialData,"Sequential Data");
        CreatePaletteNode(FlowShapes.Sort,"Sort");
        CreatePaletteNode(FlowShapes.MultiDocument,"Multidocument");
        CreatePaletteNode(FlowShapes.Collate,"Collate");
        CreatePaletteNode(FlowShapes.SummingJunction,"Summing Junction");
        CreatePaletteNode(FlowShapes.Or,"Or");
        CreatePaletteNode(FlowShapes.InternalStorage,"Internal Storage");
        CreatePaletteNode(FlowShapes.Extract,"Extract");
        CreatePaletteNode(FlowShapes.SequentialAccessStorage,"Sequential Access Storage");
        CreatePaletteNode(FlowShapes.Annotation,"Annotation");
        CreatePaletteNode(FlowShapes.Annotation2,"Annotation2");
        CreatePaletteNode(FlowShapes.Data,"Data");
        CreatePaletteNode(FlowShapes.Card,"Card");
        CreatePaletteNode(FlowShapes.Delay,"Delay");

        ConnectorList = new ObservableCollection<object>();
        CreatePaletteConnector("Link1", DiagramSegments.Orthogonal, DecoratorShapes.Arrow);
        CreatePaletteConnector("Link2", DiagramSegments.Orthogonal, DecoratorShapes.None);
        CreatePaletteConnector("Link3", DiagramSegments.Straight, DecoratorShapes.Arrow);
        CreatePaletteConnector("Link4", DiagramSegments.Straight, DecoratorShapes.None);
        CreatePaletteConnector("Link5", DiagramSegments.Bezier, DecoratorShapes.None);

        Palettes.Add(
            new SymbolPalettePalette()
            {
                Id = "flowshapepalette",
                Expanded = true,
                Symbols = FlowShapeList,
                Title = "Flowshapes"
            });
        Palettes.Add(
            new SymbolPalettePalette()
            {
                Id = "connectorpalette",
                Expanded = true,
                Symbols = ConnectorList,
                Title = "Connectors"
            });
    }

    private void CreatePaletteNode(FlowShapes flowShape, string id)
    {
        DiagramNode diagramNode = new DiagramNode()
        {
            Id = id,
            PreviewSize = new SymbolSizeModel() { Width = 100, Height = 100 },
            Shape = new DiagramShape() { Type = DiagramShapes.Flow, FlowShape = flowShape },
            Style = new NodeShapeStyle() { StrokeColor = "#757575" },
        };
        if (flowShape.ToString() == "PreDefinedProcess")
        {
            diagramNode.Id = "Predefined Process";
        }
        else if (flowShape.ToString() == "DirectData")
        {
            diagramNode.Id = "Direct Data";
        }
        else if (flowShape.ToString() == "PaperTap")
        {
            diagramNode.Id = "Punched Tape";
        }
        else if (flowShape.ToString() == "SequentialData")
        {
            diagramNode.Id = "Sequential Data";
        }
        else if (flowShape.ToString() == "MultiDocument")
        {
            diagramNode.Id = "Multidocument";
        }
        else if (flowShape.ToString() == "SummingJunction")
        {
            diagramNode.Id = "Summing Junction";
        } else if (flowShape.ToString() == "InternalStorage")
        {
            diagramNode.Id = "Internal Storage";
        } else if (flowShape.ToString() == "ManualOperation")
        {
            diagramNode.Id = "Manual operation";
        }
        else if (flowShape.ToString() == "ManualOperation")
        {
            diagramNode.Id = "Manual Operation";
        }
        else if (flowShape.ToString() == "OffPageReference")
        {
            diagramNode.Id = "Off-page reference";
        }
        else if (flowShape.ToString() == "SequentialAccessStorage")
        {
            diagramNode.Id = "Sequential Access Storage";
        }
        else if (flowShape.ToString() == "ManualInput")
        {
            diagramNode.Id = "Manual Input";
        }
        else if (flowShape.ToString() == "LoopLimit")
        {
            diagramNode.Id = "Loop Limit";
        }
        else if (flowShape.ToString() == "StoredData")
        {
            diagramNode.Id = "Stored Data";
        }
        FlowShapeList.Add(diagramNode);
    }

    private void CreatePaletteConnector(string id, DiagramSegments type, DecoratorShapes decoratorShape)
    {
        DiagramConnector diagramConnector = new DiagramConnector()
        {
            Id = id,
            PreviewSize = new SymbolSizeModel() { Width = 100, Height = 100 },
            Type = type,
            SourcePoint = new ConnectorSourcePoint() { X = 0, Y = 0 },
            TargetPoint = new ConnectorTargetPoint() { X = 60, Y = 60 },
            Style = new ConnectorShapeStyle() { StrokeWidth = 1, StrokeColor = "#757575" },
            TargetDecorator = new ConnectorTargetDecorator() 
            { 
                Shape = decoratorShape,
                Style = new DecoratorShapeStyle() { StrokeColor = "#757575", Fill = "#757575" }
            }
        };

        ConnectorList.Add(diagramConnector);
    }
}

